<style>.chosen-container-single{ width: 100%;}</style>
<div class="container-fluid">
    <div class="wrapper">
        <div class="panel" id="nav">
            <div class="panel-heading"><h3 class="panel-title">物流渠道管理列表</h3></div>
            <div class="panel-body">
                <form  action="__URL__/index" id="search-form" class="search-form">
                    <div class="container-fluid">

                        <div class="col-sm-12 col-md-4 add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">承运商名称</span>
                                <select class="chosen-select form-control" tabindex="-1" name="name" id="name"
                                        data-name-group="common">
                                    <option value="" class="empty-opt">-- 请选择承运商名 --</option>
                                    <volist name="cinfo" id="vo">
                                        <option <if condition="$vo.name eq $param['name']"> selected = "selected"</if>>{$vo.name}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="col-md-2 add-space">
                            <button class="btn btn-primary jsSearchBtn" type="submit" >搜索</button>
                            <button class="btn btn-primary jsSearchBtn" type="button" id="addCarrier">添加</button>
                        </div>

                    </div>
                </form>
                <div class="clearfix"></div>
                <hr>
                <table class="table table-striped  table-hover" cellspacing="0" width="100%">
                    <thead>
                    <tr>
                        <th width="20">序号</th>
                        <th>承运商ID</th>
                        <th>承运商名称</th>
                        <th>提货时间</th>
                        <th>提货地点</th>
                        <th>结款方式</th>
                        <th>计费方式</th>
                        <th>承运商是否启用</th>
                        <th>服务名称</th>
                        <th>时效[天]</th>
                        <th>服务是否启用</th>
                        <th width="60">操作</th>
                    </tr>
                    </thead>
                    <form action="" method="post" name="carrierList" id="carrierList">
                        <tbody>
                        <volist name="carrierResult" id="vo">
                            <tr>
                                <td rowspan="2">{$i}</td>
                                <th rowspan="2">{$vo.id}</th>
                                <td rowspan="2">{$vo.name}</td>
                                <td rowspan="2">{$vo.pickingtime}</td>
                                <td rowspan="2">{$vo.pickingaddress}</td>
                                <td rowspan="2">{$vo.paymethod}</td>
                                <td rowspan="2">{$vo.billingway}</td>
                                <td rowspan="2">{$vo.is_used}</td>
                                <if condition="count($vo['service']) eq 0">
                                    <td class="text-primary">空</td>
                                    <td>空</td>
                                    <td>空</td>
                                    <else/>
                                    <foreach name="vo['service']" item="se" key="num">
                                        <if condition="$num eq 0">
                                            <td class="text-primary">{$se.service_name}</td>
                                            <td>{$se.aging}</td>
                                            <td><if condition="$se.service_is_use eq 0">否<else/>是</if></td>
                                        </if>
                                    </foreach>
                                </if>


                                <td rowspan="2"><button class="btn btn-xs" type="button"  name="edit" value="{$vo.id}">修改</button>
                                </td>
                            </tr>
                            <tr>
                                <if condition="count($vo['service']) egt 2">
                                    <foreach name="vo['service']" item="se" key="num">
                                        <if condition="$num egt 1">
                                            <td class="text-primary">{$se.service_name}</td>
                                            <td>{$se.aging}</td>
                                            <td><if condition="$se.service_is_use eq 0">否<else/>是</if></td>
                                        </if>
                                    </foreach>

                                </if>

                            </tr>
                        </volist>
                        </tbody>
                    </form>
                </table>
                <div class="clearfix clear"></div>
                <div class="yema">页码：{$page}/{$pageSize}，总记录：<span>{$total}</span>     <div class="page pull-right">{$Pager}</div></div>
            </div>
        </div>

    </div><!---wrapper end--->

</div>




<!-------------------------当前页面js引用处--------------------------------->
<script type="text/javascript" src="__PUBLIC__/javascripts/admin/layer/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/javascripts/admin/jquery.js"></script>
<script type="application/javascript">
    $(document).ready(function(){
        /**
         * 重置
         */
        $('#reset').click(function(){
            $('#search-form').find('input').val('')
            $('#search-form').find('select').val('')
        })
        /**
         * 查看明细
         */
        $('button[name="cdetail"]').click(function(){
            var url="{:U('Carrier/getDetail')}"
            $.post(url,{id:$(this).data("id")},function(dt){
                if(dt){$("#modal-body").html(dt)}
            })
        })
        /**
         * 修改货代信息
         */
        $('button[name="edit"]').on('click',function(){
            var id=$(this).val();
            var url="{:U('Carrier/editCarrier')}?id="+id
            layer.open({
                type: 2,
                title: '修改承运商',
                shadeClose: false,
                shade: 0.8,
                area: ['60%', '60%'],
                content: url
            });

        })
        /**
         * 增加货代
         */
        $('#addCarrier').on('click',function(){
            var url="{:U('Carrier/addCarrier')}";
            layer.open({
                type: 2,
                title: '添加承运商',
                shadeClose: false,
                shade: 0.8,
                area: ['60%', '60%'],
                content: url
            });
        })


    })
    $('#myModal').modal().css({
        width: '60%',
        'margin-top':'5%',
        'margin-left': function () {
            return -($(this).width()/2)
        }
    })
    $('#myModal').modal('hide')
</script>

</body>
</html>